import React, {Component} from 'react'
import {Link, NavLink} from 'react-router-dom'
export default class NotFound extends React.Component {
  state = {
    info: 'hi',
    url: '/'
  }
  jump() {
    // 固定的：this.props.history
    this.props.history.push('/life');
  }
  render() {
    return (<div>
      <p>404,请检查地址.用于展示路由导航</p>
      {/* 内置组件Link或者NavLink实现跳转 */}
      <NavLink activeClassName="active" to={this.state.url}>回到首页</NavLink>
      {/* 编程式导航 */}
      <button onClick={()=>this.jump()}>去看生命周期</button>
    </div>)
  }
}